package com.bbcare.followup.plat.store.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bbcare.followup.plat.entity.PatientTask;
import com.bbcare.followup.plat.entity.PtLostRd;
import com.bbcare.treat.plat.entity.PtTrTask;
import org.apache.ibatis.annotations.Param;

/*
 * @name:         患者任务信息存储接口
 * @author:       DemonLee
 * @createTime:   2017.4.13
 * @description:  患者任务基本信息
 * @modify:
 *
 */
public interface IPatientTaskDAO {
    /**
     * 插入单个患者任务信息
     *
     * @param PatientTask
     * @return
     */
    public void save(PatientTask pt) throws Exception;

    /**
     * 批量插入患者任务信息
     *
     * @param List
     * @return
     */
    public void savePatientTaskBatch(List<PatientTask> pt) throws Exception;

    /**
     * 批量插入患者任务历史表
     *
     * @param ptSchemeId,updateType,updateAccept,updateTime
     * @return
     */
    public void savePatientTaskHisByPtSchemeid(HashMap<String, Object> param) throws Exception;

    /**
     * 查询患者任务list
     *
     * @param pt_schemeid
     * @return list
     */
    public List<PatientTask> selectByPtSchemeId(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 查询患者任务list
     *
     * @param 定制
     * @return list
     */
    public List<PatientTask> select(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者任务list
     *
     * @param taskId
     * @return list
     */
    public List<PatientTask> selectById(Map<String, Object> paramMap) throws Exception;

    List<PatientTask> selectByTaskId(@Param("taskId") String taskId);

    /**
     * 更新患者任务
     *
     * @param taskId,taskStatus,updateAuthor,updateType,updateAccept,updateTime
     * @return
     */
    public int updatePatientTaskById(Map<String, Object> param) throws Exception;

    /**
     * 更新患者任务
     *
     * @param taskId,taskStatus,updateAuthor,updateType,updateAccept,updateTime
     * @return
     */
    public int updatePtTaskptTaskId(Map<String, Object> param) throws Exception;

    /**
     * 更新临时随访。
     * @param tempTask
     * @return
     * @throws Exception
     */
    public int updateTempTask(final PatientTask tempTask) throws Exception;

    /**
     * 插入患者任务历史表
     *
     * @param taskId,taskStatus,updateAuthor,updateType,updateAccept,updateTime
     * @return
     */
    public void insertPatientTaskHisById(Map<String, Object> param) throws Exception;

    /**
     * 查询患者问卷模板list
     *
     * @param pt_schemeid
     * @return list
     */
    public List<Map<String, Object>> selectContentTemplByPtSchemeId(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 查询患者问卷模板list
     *
     * @param pt_schemeid
     * @return list
     */
    public List<Map<String, Object>> selectDisCntTemplByPtSchemeId(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 查询患者任务查询
     *
     * @param pt_schemeid,conTemplVerId
     * @return list
     */
    public List<HashMap<String, Object>> selectTaskByPtSchemeIdAndTempl(HashMap<String, Object> paramMap)
            throws Exception;

    /**
     * 查询患者过期任务list
     *
     * @param
     * @return list
     */
    public List<PatientTask> selectExpiredTask(Map<String, Object> paramMap) throws Exception;

    /**
     * 结案人员任务
     * @param paramMap
     * @return
     * @throws Exception
     */
    public List<PatientTask> selectCloseTask(Map<String, Object> paramMap) throws Exception;

    /**
     * 更新失访原因id
     *
     * @param
     * @return
     */
    public int updatePatientLostInfoById(Map<String, Object> param) throws Exception;

    /**
     * 插入失访记录
     *
     * @param
     * @return
     */
    public int savePatientLostInfo(PtLostRd prdVo) throws Exception;

    /**
     * 查询失访患者记录
     *
     * @param
     * @return list
     */
    public List<PtLostRd> selectPatientLostByTaskId(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者窗口期任务list
     *
     * @param
     * @return list
     */
    public List<PatientTask> listPtWinTask(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者窗口期任务list new
     *
     * @param
     * @return list
     */
    public List<PatientTask> listPtWinTaskNew(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者随访时间前N天任务list
     *
     * @param
     * @return list
     */
    public List<PatientTask> listPtFollowUPTimeTask(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者诊疗时间前N天任务list
     *
     * @param
     * @return list
     */
    public List<PtTrTask> listPtNextFollowTimeTask(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者任务list
     *
     * @param 定制
     * @return list
     */
    public List<Map<String, Object>> selectTaskStatusByPtSchemeId(Map<String, Object> paramMap) throws Exception;

    /**
     * 根据患者队列实例id更新患者任务
     *  sms_num+1
     * @param map
     * @return
     */
    public int updatePtTaskByPtSchemeId(Map<String, Object> param) throws Exception;

    /**
     * 根据患者队列实例id插入患者任务历史表
     *
     * @param map
     * @return
     */
    public void insertPtTaskHisByPtSchemeId(Map<String, Object> param) throws Exception;

	public int selectCount(HashMap<String, Object> taskInMap);

	/*
	 * @author wuyz
	 * @date 2017年07月20日
	 * @@deprecated 更新用户任务状态和时间接口
	 */
	public int updatePatientTaskByIdOnApp(HashMap<String, Object> servParamMap)throws Exception;

	/*
	 * @author wuyz
	 * @date 2017年07月21日
	 * @@deprecated 入历史
	 */
	public void insertPatientTaskHisByIdApp(HashMap<String, Object> servParamMap)throws Exception;

    /**
     * 查询当前一段时间内是否有完成的随访任务
     *
     * @param
     * @return list
     */
    public List<PatientTask> selectPtTaskForAgeSend(Map<String, Object> paramMap) throws Exception;


	/*
	 * @author wuyz
	 * @date 2018年01月08日
	 * @@deprecated 删除失访记录
	 */
	public int removeLostInfoByTaskId(Map<String, Object> servParamMap)throws Exception;
	/**
     * 根据患者队列实例id更新患者任务
     * sms_num-1
     * @param map
     * @return
     */
    public int updatePtTaskByPtSchemeIdToRMOne(Map<String, Object> param) throws Exception;
    /**
     * 通过id删除任务
     * @param servParamMap
     * @return
     * @throws Exception
     */
    public int removePtTaskptTaskById(Map<String, Object> servParamMap)throws Exception;


    /**
     * 获得上一次任务详情
     * @param param
     * @return
     * @throws Exception
     */
    PatientTask getPreviousTaskId(Map<String, Object> param)throws Exception;

    /**
     * 查询需要发送下次检查提醒的随访任务。
     * @param paramMap
     * @return
     * @throws Exception
     */
    public List<PatientTask> queryXcxWinTask(Map<String, Object> paramMap) throws Exception;

}
